﻿Public Class BookDetails
    Inherits System.Web.UI.Page
    Dim p As New Sach_DTO()
    Dim objUser As New LoginHelper("", "")
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        p._idsach = Request.QueryString("id_sach")
        Load_SachChiTiet()
    End Sub
    Public Sub Load_SachChiTiet()
        Dim show_SachChiTiet As New Sach_BLL()
        DataList_SachChiTiet.DataSource = show_SachChiTiet.Sach_ChiTiet(p)
        DataList_SachChiTiet.DataBind()
    End Sub
    Protected Sub themMuon(ByVal sender As Object, ByVal e As System.EventArgs) Handles a_themmuon.ServerClick
        Dim url, tensach, soluong As String
        objUser = TryCast(Session("sesLoginUser"), LoginHelper)
        For Each item As DataListItem In DataList_SachChiTiet.Items
            url = TryCast(item.FindControl("img_hinh"), Image).ImageUrl
            tensach = TryCast(item.FindControl("lbl_tensach"), Label).Text
            soluong = TryCast(item.FindControl("lbl_soluong"), Label).Text
        Next
        If objUser IsNot Nothing Then
            Response.Redirect("BorrowingCart.aspx?id_sach=" + p.id_sach + "&url=" + url + "&tensach=" + tensach + "&soluong=" + soluong)
        Else
            ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('Bạn Chưa Đăng Nhập - Quay Về Trang Đăng Nhập');gobackLogin();", True)

        End If


    End Sub



End Class